package com.wsjj.yjh;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class SQLDemo1 {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        StreamTableEnvironment streamTableEnv = StreamTableEnvironment.create(env);

        String sql = "CREATE TABLE flink_doris_source (\n" +
                "    id int,\n" +
                "    name varchar(50),\n" +
                "    age int\n" +
                "    )\n" +
                "    WITH (\n" +
                "      'connector' = 'doris',\n" +
                "      'fenodes' = '192.168.10.105:8030',\n" +
                "      'table.identifier' = 'test_doris.student_kafka',\n" +
                "      'username' = 'root',\n" +
                "      'password' = '000000'\n" +
                ")";
        System.out.println(sql);

        streamTableEnv.executeSql(sql);

//        streamTableEnv.executeSql("select * from flink_doris_source").print();

        streamTableEnv.executeSql("insert into flink_doris_source(id,name,age) values(111,'adfd',45)");


    }
}
